Poet personalities

ABSTRACT

A method of generating a poet personality including reading poems, each of the poems containing text, generating analysis models, each of the analysis models representing one of poems and storing the analysis models in a personality data structure. The personality data structure further includes weights, each of the weights associated with each of the analysis models. The weights include integer values.

CLAIM OF PRIORITY

This application is a continuation (and claims the benefit of priorityunder 35 USC 120) of U.S. application Ser. No. 11/169,199 filed Jun. 28,2005, now U.S. Pat. No. 7,840,608, which is a continuation of U.S.application Ser. No. 10/639,918 filed Aug. 12, 2003 (now U.S. Pat. No.7,836,069), which is a continuation of U.S. application Ser. No.09/704,104, filed Nov. 1, 2000 (now U.S. Pat. No. 6,647,395), whichclaims priority to U.S. Patent Application Ser. No. 60/162,882 filed onNov. 1, 1999. The disclosure of the prior applications are consideredpart of (and is incorporated by reference in) the disclosure of thisapplication.

BACKGROUND

This invention relates to generating poetry from a computer.

A computer may be used to generate text, such as poetry, to an outputdevice and/or storage device. The displayed text may be in response to auser input or via an automatic composition process. Devices forgenerating poetry via a computer have been proposed which involve setslot grammars in which certain parts of speech, that are provided in alist, are selected for certain slots.

SUMMARY

In an aspect, the invention features a method of generating a poetpersonality including reading poems, each of the poems containing text,generating analysis models, each of the analysis models representing oneof poems and storing the analysis models in a personality datastructure. The personality data structure further includes weights, eachof the weights associated with each of the analysis models. The weightsinclude integer values.

In another aspect a poet's assistant method including loading a wordprocessing program, receiving a word in the word processing programprovided by a user, displaying poet windows in response to receiving theword and processing the word in each of the windows. The poet windowsmay include combinations of a finish word window, a finish line windowand a finish poem window. Processing the word in the finish word windowincludes loading an analysis model, locating the word in the analysismodel and generating a proposed word in conjunction with the authoranalysis model.

The details of one or more embodiments of the invention are set forth inthe accompanying drawings and the description below. Other features,objects, and advantages of the invention will be apparent from thedescription and drawings, and from the claims.

DESCRIPTION OF DRAWINGS

The foregoing features and other aspects of the invention will bedescribed further in detail by the accompanying drawings, in which:

FIG. 1 is a block diagram of a computer system storing a poetrygeneration process.

FIG. 2 is a flow diagram of a poetry generation process using the systemof FIG. 1.

FIG. 3 is a flow diagram of a poem generation process using the systemof FIG. 1.

FIG. 4 is a table of exemplary word formats used by the process of FIG.3.

FIG. 5 is a flow diagram of the process used to analyze text.

FIG. 6 is a flow diagram of the generation of 1-grams used by theprocess of FIG. 3.

FIG. 7 is a flow diagram of the generation of bigrams used by theprocess of FIG. 3.

FIG. 8 is a flow diagram of the generation of trigrams used by theprocess of FIG. 3.

FIG. 9 is a flow diagram of the generation of quadrigrams used by theprocess of FIG. 3.

FIG. 10 is a flow diagram of the generation of words used by the processof FIG. 3.

FIG. 11 is a flow diagram of the generation of a poem without rhythm andrhyme structure used by the process of FIG. 3.

FIG. 12 is a flow diagram of the generation of a word with rhythm andrhyme structure used by the process of FIG. 3.

FIG. 13 is a flow diagram of the generation of a line with rhythm andrhyme structure used by the process of FIG. 3.

FIG. 14 is a flow diagram of the generation of a poem with rhythm andrhyme structure used by the process of FIG. 3.

FIG. 15 is a diagram of an exemplary poet's assistant graphical userinterface.

Like reference symbols in the various drawings indicate like elements.

DETAILED DESCRIPTION

Referring to FIG. 1, a computer system 10 for generating poetry includesat least a central processing unit (CPU) 14, a memory 16 containing apoetry generation process (not shown), a link 18 to a storage device 20,and a link 22 to a display unit 24. The storage device 20 may containone or more data files 26 and 28. The display unit 24 also includes aninput device 30, such as a keyboard and mouse, for example. The memory16 includes a windows-based operating system (not shown), such asMicrosoft Windows or Linux with Xfree Windows, for example, and a wordprocessing program (not shown), such as Microsoft Word or CorelWordPerfect, for example.

In a particular embodiment, the operating system is Windows 95 and thecomputer system 10 includes Microsoft Word95, both from MicrosoftCorporation of Redman, Wash. Further, the computer system 10 includes aminimum of four megabytes of random access memory (RAM) and twentymegabytes of storage space on the storage device 20.

Referring to FIG. 2, a poetry generation process 30 analyzes 32 anoriginal poem and generates 34 an author analysis model. New poems areautomatically generated 36 in conjunction with the author analysis modeland/or in response to user input. The new poetry is outputted 38 to adisplay, printed or stored on a storage device.

Referring to FIG. 3, a process 40 to generate an original poem includesscanning 42 selections of poems by an author. The poems scanned are usedto generate and store 44 an author analysis model. A user selects 46 aninterface, specifically, a poetic assistant interface 48 and/or a screensaver interface 50. The process generates 52 an original poem(s) fromthe author analysis model. The original poem(s) is displayed 54 on thedisplay unit, or stored on a suitable storage medium. The poem will havea similar style to the poem(s) originally analyzed and contained in theauthor analysis model, but will be original poetry generated by theprocess 30 (of FIG. 2).

The process 40 (of FIG. 3) may combine authors by generating poetpersonalities using multiple author analysis models. A poet personalityalso includes a set of parameters that control certain aspects of thepoetry generation process. Thus, there can be a combination of authoranalysis models in a single poet personality.

As indicated above, selections of poems by an author are scanned by theprocess 40 to generate an author analysis model. The selection of poemstypically includes an input file of poems with titles of a particularauthor. In a particular embodiment, poems to be analyzed are containedin an ASCII text file that contains one poem after another. Each poemcontains a title, a blank line, the poem on multiple lines, with oneblank line between stanzas, and another blank line. At the end of thepoems a terminal line containing only “******” may optionally be placed.However, the process will stop reading the input poem(s) at the end ofthe ASCII text file.

Rhyme words are marked with a rhyme number during initial processing ofthe ASCII text, i.e., words which rhyme with each other, are specifiedin the author analysis model by the characters “\\\number\\\”, wherenumber is an integer with no commas, e.g., \\\4\\\. Words that rhymewith each other would have the same number, generally referred to asrhyme numbers, and thus be a member of the same rhyme set. Rhyme wordsare expected only at the end of a line and the rhyme number typicallystarts over with each stanza.

Referring to FIG. 4, a table having words and their associated rhymenumbering is shown for the poem “why go slam, know the lamb.” The words“lamb” and “slam” are both numbered \\\1\\\ since they rhyme with eachother and are placed in a first rhyme set, while “go” and “know” arenumbered \\\2\\\ since they rhyme with each other, and not with “lamb”and “slam,” and thus are numbered to indicate membership in a secondrhyme set. The resulting poem is: why go \\\2\\\slam\\\1\\\, know\\\2\\\ the lamb \\\1\\\.

Once marked with rhyme numbers, the text is further analyzed to generatea linked data structure that specifies all n-grams found in the text,where 2<=n<=4. Ngrams are sequences of n consecutive characters in adocument. Ngrams are generated from a document by sliding a “window” ofn characters wide across the document's text, moving it one character ata time. Thus, the word “testing” would generate the penta-grams “testi”“estin” and “sting”. In addition, all text may be converted to a singlecase and non-alphabetic characters may be turned into spaces. Afterthese transformations, sequences of consecutive blanks are compressedinto a single space. The linked data structure (also referred to as ann-gram data structure) is stored in a data file located on a suitablestorage unit as an author analysis model.

The end of line (EOL), end of poem (EOP), beginning of line (BOL), andbeginning of poem (BOP) are considered special characters. In aparticular embodiment, each stanza is considered to be a poem. There isno difference between the end of a stanza in an input set of poems to beanalyzed and the end of the last stanza in a poem. In one embodiment,the process writes one stanza poems. For other embodiments the processmay write multiple stanza poems. Thus, for any user input word theprocess can access a linked data structure from the data file of authoranalysis models and determine all of the words that followed that userinput word in the author analysis model, along with a count for thatbigram.

Punctuation also is attached to the word it abuts. For example, “house”differs from “house,” or “house!”. For any pair of user input words theprocess can access linked data structure from the data file of authoranalysis models and determine all of the words that followed that wordin the author analysis model along with a count for that trigram. Forany triple grouping of user input words, the process can access a linkeddata structure and determine all the words that followed that word inthe author analysis model with a count for that quadrigram. In aparticular embodiment, a word hash table allows looking up a word in theauthor analysis model and quickly determining a pointer into linked datastructure.

Thus, for each word, line, and stanza analyzed from an author, itscorresponding linked data structure is generated and includes at leastthe following elements:

-   -   (1) Pointer to a word    -   (2) Number of characters in the word    -   (3) Count for this n-gram    -   (4) Pointer to the next structure in the chain    -   (5) Pointer to first structure at level n+1    -   (6) Number of structures at level n+1

In a preferred embodiment, the above linked data structure elements arethe following data types using the C language:

-   -   ngram DEFTYPE struct    -   (1) *CHAR    -   (2) BYTE    -   (3) SHORT    -   (4) *ngram    -   (5) *ngram    -   (6) SHORT

Other data definitions preferably included in the ngram structure arethe following, with their C language data type following:

*gram Pointer to first structure *gram Pointer to last structureassigned SHORT Number of structures assigned n1_gram pointer to thefirst word in the ngram structures during decoding n2_gram pointer tothe second word in the ngram structures during decoding n3_gram pointerto the third word in the ngram structures during decoding n4_grampointer to the fourth word in the ngram structures during decodinghash_0 pointer to the first entry in the hash table for words, entriesare addresses which point to the first character of a word. hash_sizenumber of entries allocated in word hash table hash_assign_n number ofentries assigned in word hash table hash_word_n pointer to first entryin associated hash table which contains the size of each wordrhyme_hash_0 pointer to first entry in the hash table for rhyme wordsrhyme_hash_size number of entries allocated in rhyme hash tablerhyme_hash_n pointer to first entry in the associated rhyme hash tablewhich contains the size of each word current_rhyme_target pointer tocurrent rhyme target word in ngram structures time_limit_1 time limitfor first phase of recursive line generation time_limit_2 time limit forsecond phase of recursive line generation time_limit_3 time limit forthird phase of recursive line generation time_limit_4 time limit forfourth phase of recursive line generation author_weight weight of anauthor within a poet personality ngram_2_count bigram count for a wordfor which a score is being computed ngram_2_weight weight for the bigramfor this author within this poet personality ngram_2_exponent exponentfor the bigram count for this author within this poet personalityngram_3_count trigram count for a word for which a score is beingcomputed ngram_3_weight weight for the trigram for this author withinthis poet personality ngram_3_exponent exponent for the trigram countfor this author within this poet personality ngram_4_count quadrigramcount for a word for which a score is being computed ngram_4_weightweight for the quadrigram ram for this author within this poetpersonality ngram_4_exponent exponent for the quadrigram count for thisauthor within this poet personality

Referring to FIG. 5, a process 60 used to analyze text includesgenerating an n-gram by processing 62 input text, such as ASCII textstored in an input file. Lines containing a title are ignored anddiscarded 64. A first word in the text under analysis has a specialcharacter (BOP) placed 66 in front of the first character. The last wordin the poem has a special character (EOP) placed 68 after a lastcharacter of the word. The first word in each line has a specialcharacter (BOL) placed 70 in front of the first character. The last wordin each line has a special character (EOL) placed 72 after the lastcharacter of the word. Carriage return and linefeed characters arediscarded 74. All punctuation associated with the word is treated likeany other character. Each stanza is treated as a separate poem, and thelast word of the stanza is an end-of-poem word and is terminated 76 withthe (EOP) character. The process 60 generates 76 a linked data structurefor the text. The linked data structure includes 1-grams, bigrams,trigrams, and quadrigrams in both a forward and backward direction. Asmentioned above, for any subsequent user input word, the process 60 canlocate the user input word in the linked data structure and determinewords that follow it in the link structure. The process 60 may also“back up” one word in the linked data structure, if needed.

Referring now to FIG. 6, the process 80 used to generate the 1-gramsfrom the processed text of FIG. 5 includes feeding 82 the processed textand scanning 84 the processed text word by word. The process determines86 whether a word has been scanned. For each word scanned, a look-up isperformed 88 on a word hash table. A determination 90 is made as towhether the word was found in the word hash table.

If the word is found in the word hash table, the appropriate count inthe link structure (ngram structure) for the word is incremented 92 andthe process checks 86 whether another word was scanned. The countindicates a number of occurrences of the word in the link structure. Ifthe word is not found in the word hash table, the word is added 94 tothe word hash table and a hash assign number is associated with theword. The process 80 sets up 96 1-gram in the n-gram structure for theword. The ngram structure will include at least an address of the firstcharacter of the word, the number of characters in the word, and a countequal to one. All of the 1-gram words will be in a chain in the ngramstructure. The process 80 then checks 86 whether another word wasscanned. If not, the process 80 exits 98.

Referring to FIG. 7, a process 100 used to generate bigrams includes,for each 1-gram in a linked data structure, all examples of the word inthe scanned text are found 102. A list of words that follow the wordbeing scanned, along with associated counts, is generated 104 for eachword. For each following word, an ngram structure at the bigram levelwith appropriate pointers is generated 106. The ngram structure at thebigram level will include at least an address of the first character ofthe second word in the bigram, the number of characters in the wordbeing scanned, a count equal to one, and an address of next bigram forthe word being scanned to provide a chain of words.

To generate a trigram, the process assumes that all of the 1-gram wordswill be in a chain in the ngram structures. Each 1-gram in the linkeddata structure is processed and, all of the bigrams for that word arescanned.

Referring now to FIG. 8, a process 110 used to generate trigramsdetermines 112 all examples of the bigram in the text. A list of allwords that follow the bigram with counts for each trigrams word isgenerated 114. For each trigram, an ngram structure at the trigram levelwith the appropriate pointers is generated 116. The appropriate linkstructure for each trigram includes at least the address of the firstcharacter of the third word in the trigram, the number of characters inthe word, count set equal to zero, and an address of a next trigram forthe word under analysis, to generate a chain of trigrams for the wordbeing scanned.

To generate a quadrigram, the process 100 assumes of the 1-gram wordsare in a chain of words in the ngram structures.

Each word in the chain is processed. For each word, all of the bigramsfor that word are scanned. For each bigram, all of the trigrams for theword under analysis are scanned.

Referring now to FIG. 9, a process 120 used to generate a quadrigramlocates 122 all occurrences of the trigram in the text being processed.A list of all words following the associated trigram with counts foreach scanned word is generated 124. For each quadrigram, an ngramstructure at the quadrigram level with the appropriate pointers isgenerated 126. The link structure contains at least an address of thefirst character of the fourth word in the quadrigram, the number ofcharacters in the fourth word, a count equal to one, and the address ofa next quadrigram for the word under analysis to generate a chain ofquadrigrams for the word being scanned.

In an alternate embodiment, instead of first processing all 1-grams,then all bigrams, then all trigrams and then all quadrigrams, theprocess may generate all the 1-grams, bigrams, trigrams and quadrigramsfor a particular word, then go to the next word, and so on, until allwords are processed.

As mentioned above, a backward ngram analysis is also performed unlessthere are no rhyme words (indicated by the absence of rhyme numbers).The backwards ngram structures (with 1-grams, bigrams, trigrams andquadrigrams with the words in reverse) is used for various stages in arecursive process to generate lines that match a rhythm and rhymecriteria fully described below.

An input to a rhyme analysis utility is a set of poems with the rhymeword sets indicated, as discussed above. A user can convert a set ofpoems without rhyme word sets indicated to one with the rhyme word setsindicated, using the rhyme analysis utility.

The output of the rhyme analysis utility is a set of ngram structuressimilar to bigrams. Instead of bigrams, however, the word pairs indicateword rhyme pairs.

For a rhyme pair “a” and “b”, both “a” followed by “b” and “b” followedby “a” are put in as rhyme “bigrams”.

For rhyme sets of more than two words, all combinations are generated.Thus, by way of example, if “spin”, “begin” and “within” were a threeword rhyme set, then all of the following six rhyme “bigrams” would beput into ngram structures:

-   -   spin begin    -   begin spin    -   spin within    -   within spin    -   begin within    -   within begin

The rhythm and rhyme structures found in the poems are also analyzed andsaved by the process. A rhythm/rhyme structure of “20 a b b a” signifiesthat the lines have an average of 20 syllables, and the rhyme pattern isthe last word of the first line rhymes with the last word of the fourthline, the last word of the second line rhymes with the last word of thethird line, and so forth.

The number of syllables in a word is determined by the process as amapping of the number of characters, based on a set of parameters, andtherefore, the number of syllables is only an estimate.

There are three forms of output from the rhyme analysis utility:

-   -   1. printing of all rhyme pairs    -   2. printing of all words on a line which all rhyme with each        other.    -   3. printing of the rhythm and rhyme structures found in the        analyzed poems.

In summary, the process 30 (of FIG. 2) generates and stores a series ofdata structures for an author's poem in a data file. Each author poemhas a data file containing linked data structures representing rhymesets and words that precede and follow each individual word of eachindividual poem, i.e., 1-grams, bigrams, trigrams and quadrigrams. Thisdatafile is used by the process to generate original poetry that mayrhyme or not. As a user inputs a word via a word processing program, theprocess locates the user word in an appropriate author analysis model.Once the word is located in the author analysis model, the process 30can generate a next word, can complete a line, and/or can complete apoem by looking at the 1-grams, bigrams, trigrams and quadrigrams forthe user word.

Referring now to FIG. 10, a process 130 used for basic word generationincludes generating 132 a list of words that follow the last wordwritten by a user or automatically by the process and saved in memory,providing a user linked data structure. Pointers to user n-gram datastructure generated for a new original poem, described below, arecontinually updated, so that the pointer for the current bigram becomesa pointer to the current trigram once a word is written by the user orprocess.

A new word is received 134 from the user (e.g., via keyword input in aword processing program) or randomly generated by the process from anauthor analysis model. A count is determined 136 for the user n-gramstructure being assembled (i.e., 1-gram, bigram, trigram and quadrigram)and stored in memory for the new poem. A score is computed 138 for eachnew word input by the user. A bigram count is raised to thebigram_exponent_parameter power and multiplied by the bigram_weight. Thetrigram count is raised to the trigram_exponent_parameter power andmultiplied by the trigram_weight. The quadrigram count is raised to thequadrigram_exponent_parameter power and multiplied by thequadrigram_weight. These three values are added together to form thescore for that word. Thus,score=author_weight*(ngram_(—)2_weight*(ngram_(—)2_count**ngram_(—)2_exponent)+(ngram_(—)3_weight*(ngram_(—)3_count**ngram_(—)3_exponent)+(ngram_(—)4_weight*(ngram_(—)4_count**ngram_(—)4_exponent))

If there is more than one author analysis model in a poet personalitybeing used by the user in generating the new poem, described below, thenthe score is the sum of the scores achieved for each author analysismodel selected by the user and contained in the poet personality. Theparameters author_weight, ngram_(—)2_weight, ngram_(—)2_exponent,ngram_(—)3_weight, ngram_(—)3_exponent, ngram_(—)4_weight, andngram_(—)4_exponent are different for each author in a poet personality.

A poet personality contains one or more author analysis models and isunder user control. If the poet personality contains more than oneauthor analysis model, each of the link structures contained in eachauthor analysis model are used by the process to generate new words,lines and stanzas for the user. Each author analysis model within a poetpersonality has its own set of bigram, trigram and quadrigram exponentand weight parameters. There is also an overall parameter providingweight for each author analysis model (author_weight) within a poetpersonality, which also can be user selected.

After the user inputs a word, the process uses a random number generatorto choose 140, a next word from a list of possiblebigram/trigram/quadrigram words found in the author analysis model(s)within the poet personality, with each process provided word given aprobability of being selected proportional to its score. A root “word”(BOP) is selected 142 which has bigrams to words in the author analysismodel that start with the BOP special character. A word is then written144 by the process that ends with the special character EOP. The processdetermines 146 whether there is another word inputted by the user. Ifnot, the process ends 148. If there is another word, the process beginsagain 132.

Using the basic word generation process described above with referenceto FIG. 10, the process 130 may write a poem without rhythm and rhymestructure (i.e., ignoring rhyme numbers) and with rhythm and rhymestructure (i.e., considering rhyme numbers).

Referring now to FIG. 11, a process 160 for writing a poem withoutrhythm and rhythm structure begins with Beginning of Poem (BOP) thatpoints to words that start with the End of Poem (EOP) special character162. The process continues where n1_gram points 164 to this firstprinted word. The variables n2_gram, n3_gram, and n4_gram areinitialized 166 to zero. The process loops back to 172 to recursivelybegin again. If the last word written ends with the End of Poem (EOP)special character 168 the process ends at 170. Otherwise, the processloops back 162.

Writing a poem with rhythm and rhyme structure involves recursivegeneration of each line to achieve rhyme and rhythm.

As described above, a poem maybe generated simply by starting with (EOP)and generating words using the basic word generation process of FIG. 10until a word ending in (EOP) is generated.

A poem may optionally have a rhythm and rhyme structure.

A rhythm structure specifies a target length for the line as a number ofsyllables. In a particular embodiment, the process does not use adictionary specifying the number of syllables in each word. Instead, asimple look-up table is used to map the number of characters in a wordto the number of syllables.

A target length for a line is the number of syllables specified by therhythm structure plus or minus a fraction of that length specified by aparameter.

The rhyme structure specifies the pattern of rhyme words, as well as thenumber of lines.

For example, a poem may specify 20 syllables and a rhyme structure of:“1,1,2,2,3,3,4,4”.

This means there are eight lines and the last word in line 1 rhymes withthe last word in line 2, the last word in line 3 rhymes with the lastword in line 4, the last word in line 5 rhymes with the last word inline 6, and the last word in line 7 rhymes with the last word in line 8.

If a rhyme structure was 1,2,2,1,3,4,4,3, then the last word of thefirst line rhymes with the last word of the fourth line, the last wordof the second line rhymes with the last word of the third line, the lastword of the fifth line rhymes with the last word of the eighth line, andthe last word of the sixth line rhymes with the last word of the seventhline.

Rhythm and rhyme structures may be extracted from an author analysismodel or specified by the user or designer.

A recursive generation process is used to generate lines provided by thebasic word generation process described above with reference to FIG. 10,yet also follows the rhythm and rhyme structure. Using the recursivegeneration process, the process potentially tries every combination ofvalid word sequences (generated by the basic word generation process ofFIG. 10) to find (the first) word that matches the rhythm structure(defined as a length in syllables, with the number of syllables in eachword inferred from word length) and rhyme structure (defined as findinga line end word that is in a rhyme pair with a target rhyme word in aprevious line, if any).

Each displaying and/or storing of a new poem involves the execution ofthree routines, i.e., a write word routine, a write line routine, and awrite poem routine.

Referring to FIG. 12, a process 180 used for writing a word with rhythmand rhythm structure begins with initializing 182 an arbitrary successvariable to zero. The word generation process of FIG. 10 is used toselect 184 a word from an author analysis model that has not beenselected yet. A determination 186 is made if there are no words thathave already been selected in this loop that are remaining. If there areno words, the process backs up 188 one word in the author analysis modeland then loops to select 184 a word. If there are words that have beenselected, a determination 190 is made on whether the line is now“successful”. Success is defined as being within the length range andhaving a proper rhyme word if a rhyme word is needed, or any word if norhyme word is needed. If the word is successful, the word is displayedor stored 192. Updated pointers into the linked ngram structure aregenerated 194 for the dynamic user n-gram structure being used torepresent the words being written by the process for the user. Thesuccess variable is then set equal to one 196 and the process exits 198.If the word is not successful, a determination 200 is made on whetherthe selected word is less than the maximum length and not having aproper rhyme word within the length range. The selected word isdisplayed 202 if it is less than the maximum length and does not have aproper rhyme word within the length range. The pointers into the usern-gram structure are updated 204 and the process initializes 182 thesuccess variable to zero. If the selected word is greater than themaximum length and has the proper rhyme word within the length range,the process backs up one word 188 in the other analysis model.

Referring to FIG. 13, a process 210 used for writing a line with rhythmand rhythm structure begins by writing 212 a word (in the methoddescribed in conjunction with FIG. 11). The process then determines 214whether the success variable is set equal to zero. If the successvariable is equal to zero, the process writes 212 a word obtained fromthe author analysis model. If the success variable is not one, theprocess exits at 216.

Referring to FIG. 14, a process 220 used for writing a poem with rhythmand rhythm structure starts 220 with the special character end of poem(EOP). A set of variables are initialized 224. More specifically,n1_gram points to EOP. N2_gram, n3_gram, n4_gram are all set equal tozero. The process writes 226 a line before the EOP. The processdetermines 228 if the last word written in the most recent line endswith the special character end of poem (EOP). If it does not, theprocess writes 226 a line. If the last word written does end with thespecial character end of poem (EOP), the process exits 230.

The above process 220 describes a forward recursive method to write aline using a Markov modeling based next-word generation process, andusing a recursive method to generate all possible word combinationsuntil an appropriate rhyme word is found (if any are required) withinthe appropriate length (rhythm) range. This recursive process may loopindefinitely, and thus a time limit is used. If this time limit isexceeded, then other strategies are used by the process which may“break” the link between the last word of the previous line and thefirst word of the current line. The following alternatives may be:

-   -   1. First try, the above forward recursive algorithm within a        time limit (time_limit). If successful, the process is finished        with the line;    -   2. If (1.) is not successful within time_limit_1, then try a        backward process. Generate the line backwards, using a backwards        link structure. The “first” word in the backwards line (which        will become the last word) is the desired rhyme word. Generate        the line backwards in the same recursive manner as (1.) above,        until the last word in the backwards line (which will become the        first word) is found that properly links up with the actual last        word of the previous line. This process is tried within the time        limit defined by time_limit_2;    -   3. If (2.) is not successful within time_limit_2, then try the        backwards process again, but the last word in the backwards line        (which will become the first word in the line) may be any        start-line word (i.e., any word that begins with the character        (BOL)), not necessarily one that links to the actual last word        of the previous line. This process is tried within the time        limit defined by time_limit_3; if 3 is not successful with        time_limit_3, then try the backwards process again, but the word        in the backwards line (which will become the first word in the        line) may be any word, not necessarily one that starts with the        character (BOL).

Referring back to FIG. 3, the user of the process 40 selects aninterface 46. The user may select the screen saver interface 50. As auser “right clicks” on the desktop of the Windows 95 operating systemuser interface, a dialogue box appears. Choosing “properties,” then“screen saver,” then “poet screen,” generates additional screen saverdialogue boxes that are used in conjunction with the computer generatedcomputer system as described above.

In an embodiment, a primary screen saver dialogue contains one or moreof the following information and options.

Information on upgrade A link to a dialogue box which contains furtherinformation including ordering Basic screen saver options Length of timeto wait before initiating screen saver mode and which corner of thescreen moving the mouse to will initiate screen saver mode Select fromavailable poet Activates the number chosen personalities Select orderRandom or sequential Color of poems Random or selected Background ColorFont Font color Size Font size Save Write to disk or not Scrolling Rateof scrolling Random number generator On or off Control Scrolling{graveover ( )} Stop or rate of scrolling

The above choices may have default values. The choices also may requiremore than one dialogue box, in which case appropriate parameters wouldbe grouped into a secondary box. Once the screen saver is activated, onepoem after another scrolls by at a user controllable rate (controlled bya dialogue box parameter). The poems appear in a font, font size andcolor selected by the appropriate dialogue box parameters with thespecified color.

Referring back to FIG. 3, the user may select the poet assistant userinterface 50. An example of poet's assistant interface is shown in FIG.16, described below. In a poet's assistant dialogue box within the wordprocessing program, the user selects as many poet's assistant windows asdesired. For each selected window, the user further chooses a poetpersonality, and a choice of ‘next word display,’ ‘finish line display,’or ‘finish poem display.’ As will become apparent, a choice of next worddisplay will provide a ‘next word’ after the user types a word in theword processing program, the choice of ‘finish line’ will provide acompleted line after the user types a word in the word processingprogram, and the choice of ‘finish poem’ will provide a complete poem,i.e., one stanza, after the user types a word in the word processingprogram.

The poet's assistant dialogue box also includes a button to activate a‘define poet personality’ dialogue box, described below, and an ‘analyzeauthor’ dialogue box. In an embodiment, these two actions, i.e., definepoet personality and analyze author, may be activated from a toolspull-down menu when the poet's assistant dialogue box is open or whenthe word processing program is open.

As previously mentioned, the user writes his/her poem(s) in a wordprocessing program executing on Microsoft Windows95. Superimposed inMicrosoft Word, for example, while the user is writing his/her poems arethe multiple poet's assistant windows, as selected in the poet'sassistant dialogue box. Each poet's assistant window starts out at acertain size, but can be moved and sized by the user as provided by theoperating system.

Each poet's assistant window has a title indicating the name of the poetpersonality, the authors included in that poet personality, and anindication of whether it is a next word display, next line display, orfinish poem display.

The process of the computer generated poetry system will write one wordat a time in each of the windows, alternating between each of thewindows. Once the visible portion of the windows is filled, processcontinues to write words to all of these poet's assistant's windows, sothe user may scroll to view the additional text, as provided by theoperating system.

The user can cut, copy and paste text from any of these poet's assistantwindows to his or her poem in the Microsoft Word display, as provided bythe operating system and the word processing program. Additionally, theuser may write a word and query the process to provide a list of all thewords that rhyme with that word as found in any of the author analysismodels.

A “Define Poet Personality” dialogue box may be activated by a button inthe Poet's Assistant Dialogue Box (or, alternatively, by selection of anitem from a Tools menu).

A Poet Personality is based on the previous analysis of one or moreauthors and thus involves one or more author analysis models. The DefinePoet Personality dialogue box prompts the user to select one or moreauthors from the list of authors that have been analyzed previously andfor which author analysis models exist. The user is also prompted togive a personalized name to the Poet Personality.

For each author analysis model in the Poet Personality, the user canlink to another dialogue box to provide poem generation parameters forthat author analysis model within the Poet Personality. If the user doesnot link to this additional dialogue box, then default parameters areprovided.

In an embodiment, these parameters are listed in the following tablewith their default values, if appropriate.

Overall Weight for this Author default = 1 Weight of bigram originalpoet default = 1 Exponent of bigram original default = 1. A highexponent poet will give higher priority to higher bigram counts. Abigram exponent =>3 or 4 will tend to give absolute priority to highercounts. An exponent of 1 will scale the probabilities equal to therelative counts. An exponent between 0 and 1 will give only softpriority to higher counts. Thus a high exponent will more closely followthe original author, but too high an exponent risks writing the samepoem over and over. Negative exponents will actually give higher weightto lower counts and visa versa. Weight of trigram original poet default= 1 Exponent of trigram original default = 1 poet Weight of quadrigramoriginal default = −100. The reason poet for a high negative weight forthe quadrigram original poet is that we are using the quadrigramoriginal poet as a plagiarism avoidance algorithm. A large positiveweight on the quadrigram original poet would closely follow the originalauthor, but would risk plagiarizing that author. A large negative weightprevents plagiarism. Exponent of quadrigram original default = 1 poetProbability of using the rhythm/ default = 1 rhyme structures for thisauthor

A high exponent exaggerates the difference in counts. For example, anexponent of 2 means that a count of 1 stays 1, whereas a count of 2becomes 4 and a count of 3 becomes 9. An exponent of 3 means that acount of 1 stays 1, whereas a count of 2 becomes 8 and a count of 3becomes 27. In a particular embodiment, all parameters includingexponents are floating point and can include fractions. Thus, a highexponent (4 or greater) would tend to make the higher counts usually“win”. A very high exponent would mean that the highest count would winvirtually all the time. The advantage of a high exponent is that ittends to select the words with the higher bigram or trigram counts, andthus follows more closely the word patterns found in the author analysismodel. It should also be noted that the generated poems would notplagiarize the poems of the original authors because of the highnegative weight on the quadrigram original author analysis model whichtends to act as an anti-plagiarism safeguard. The disadvantage of a highexponent is that the process will tend to always select the highestcount and thus will be more likely to repeat itself. With a very highexponent, the process will tend to always write the same poem given thesame start word. For this reason, the process does not use theparameters for the first word, but uses default parameters with weightsand exponents=1. With a very high exponent, the process will tend towrite the same poem for a particular start word, and thus will write asmany different poems as there are start words, which would approximatelyequal the number of poems that were analyzed in the author analysismodel. Thus a very high exponent would result in interesting poems, buta limited number of them.

The advantage of lower exponents (around 1) is that the number of poemsis very large, but they will follow the original author somewhat lessclosely. An exponent of 1, however, will weight the probabilities in thesame way that the original author did.

Exponents between 0 and 1 will emphasize higher counts only in a “soft”way, and will give only somewhat higher weight to higher counts. Anexponent of 0 will ignore counts and will give all of the possiblebigram and trigram words an equal weight regardless of their frequencyin the author analysis model. However, the next word will still belimited to word sequences that did occur in the bigrams and trigrams ofthe author analysis model.

A negative exponent will give preference to lower counts. A highnegative exponent will tend to give absolute priority to the lowestcount, which is usually 1.

The bigram and trigram original poet weights provide the relativeinfluence of these two original poets. The trigram original poet willtend to produce word sequences that more closely follow the originalauthor, although again plagiarism is avoided as long as there is astrong negative weight on the quadrigram original poet.

A strong negative weight on the quadrigram original poet will avoidplagiarism (defined as four words in a row that match the originalauthor), although if none of the possible bigram and trigram wordsavoids a four-long string from the author analysis model, then one ofthese words will be used even though that four-word sequence appeared inthe author analysis model. Otherwise, the program would just have tohalt, which is not desirable. Thus a strong negative weight on thequadrigram original poet avoids plagiarism unless it cannot be avoidedin a particular situation, which would tend to be rare.

If one puts a strong positive weight on the quadrigram original poet anda high quadrigram exponent, then the process would tend to generatepoems that matched the ones analyzed.

An Analyze Author dialogue box is activated by a button in the Poet'sAssistant Dialogue Box (or, alternatively, by selection of an item fromthe tools menu), and is part of the operating system and associated wordprocessing program.

The user specifies an input and output file. The input file containspoems in the appropriate format. The output file contains the analyzedmodel.

The user also specifies the name of the author (or some otherdescription of the collection of poems/text being analyzed).

The dialogue box contains a button which activates the analysis.

It is preferred that the analysis should contain some progressindicator.

Another button activates an interactive utility that allows the user tospecify rhyme words within a set of poems.

As indicated above, a name is specified for the poet personality.

For each poet personality (which can include multiple author analysismodels), a number of authors may be specified. For each author within apoet personality, there are the following parameters with their Clanguage data types:

Identity of author file STRING User input author_weight DOUBLE weight ofan author within a poet personality Ngram_2_weight DOUBLE weight for thebigram for this author within this poet personality Ngram_2_exponentDOUBLE exponent for the bigram count for this author within this poetpersonality Ngram_3_weight DOUBLE weight for this trigram for thisauthor within this poet personality Ngram_3_exponent DOUBLE exponent forthe trigram count for this author within this poet personalityNgram_4_weight DOUBLE weight for the quadrigram ram for this authorwithin this poet personality Ngram_4_exponent DOUBLE exponent for thequadrigram count for this author within this poet personality

Thus, in poet's assistance mode, the user is writing his or her own poemusing a suitable word processing program. The process monitors what theuser is writing. The process displays a number of windows that providesuggestions to the user to help stimulate the user's imagination. Eachwindow is associated with a particular poet personality, that is definedby one or more author analysis models plus a set of poetry generationparameters for each author analysis model described above.

Referring to FIG. 15, a poet's assistant graphical user interface (GUI)250 includes a word processing region 252 and a number of poet'sassistant's windows 254, 256, and 258. Although only three poet'sassistant's windows 254, 256, and 258 are shown, any number of poet'sassistant's windows may be requested by a user. In the poet's assistantGUI 250, poet's assistant window 254 is a next word window. Poet'sassistant window 256 is a finish line window, and poet's assistantwindow 258 is a finish poem window. Other windows that may be requestedby the user include an alliteration window (not shown) and arhymes/endings window (not shown).

Each of the poet's assistant windows 254-258 provide output in responseto highlighted words generated by the user in the word processing region252. Specifically, the next word window 254 provides suggestions for anext word in a style of a poet personality chosen by the user. Thefinish line window 256 provides suggestions for an entire line of textin the style of the poet personality chosen by the user. The finish poemwindow 258 provides a finished poem in the style of the poet personalitychosen by the user.

The rhymes/endings window (not shown) provides suggestion of words thatrhyme with the users inputted words in the poet's assistant GUI 250.

Each poet's assistant window 254-258 provides the user with a selectionof author analysis models to be included in a poet personality.

As mentioned above, the user can have as many poet's assistant windowsopened as desired. It is recommended that the user have multiple poet'sassistant windows to provide as much stimulation as possible. Forexample, the user could have ten windows, three of which would beassociated with a Robert Frost author analysis model, one in finish poemmode 258, one in finish line mode 256 and one in next word mode 254, twowindows associated with a T. S. Elliot author analysis model and fourother windows associated with other author analysis models.

Every time the user writes another word in the word processing region252 using the word processing program or in any way modifies the poem heor she is writing, all of the poet's assistant windows 254-258 change.The user can use the mouse to select words or any size selection of textfrom any of the poet's assistant windows 254-258 to paste into the poembeing composed by the user in the word processing region 252. Doing thiswould of course change the user's poem in the word processing region 252and would cause all of the poet's assistance windows 254-258 to changeand generate new suggestions.

A purpose of the poet's assistant GUI 250 is not necessarily to writethe user's poems for him or her, but rather to spark the user'simagination, to help suggest words, phrases, ideas, etc. In writingpoetry one of the most difficult aspects is finding ideas andsuggestions for words and phrases. Such reference works as dictionaries,thesauruses, rhyming dictionaries, etc., are usually limited in theirusefulness for this purpose. The poet's assistance mode is intended toprovide a rich ever-changing source of such words and ideas.

As mentioned above, the poet's assistance GUI 250 also providesassistance in finding rhyme words in rhyme word window (not shown). Theuser can highlight words in the word processing region 252 from whichrhymes are desired, and the poet's assistant rhyme window will suggestrhyme words that were actually used for the original author's that wereanalyzed in any of the selected author analysis models of the poetpersonality. The finish poem window 258 and finish line window 254 alsowrite lines in poems that follow the appropriate rhyme structure.

The author analysis can also analyze his or her own poems as a basis foran author analysis model and then define one or more poet personalitiesbased on his or her own work. In this way, in the poet assistant GUI250, suggestions will be provided as to how the user himself or herselfwould finish a poem or line or suggest the next word based on thatuser's own work. A user can also generate poet personalities thatcombine his or her own author analysis model with the author analysismodels from other authors.

It is to be understood that while the invention has been described inconjunction with the detailed description thereof, the foregoingdescription is intended to illustrate and not limit the scope of theinvention, which is defined by the scope of the appended claims. Otheraspects, advantages, and modifications are within the scope of thefollowing claims.

What is claimed is:
 1. A computer-implemented method of generating apoet personality comprising: analyzing by one or more computers aplurality of poems, each of the poems containing a plurality of words;generating by the one or more computers a plurality of analysis models,each of said analysis models representing one of said plurality ofpoems, by marking by the one or more computers words in the poems withrhyme numbers with words that rhyme with each other having the samerhyme number; generating by the one or more computers a data structurethat specifies n-grams found in the text, with each analysis modelhaying a set of weights, bigram, trigram and quadgram exponents; andstoring the plurality of analysis models in a personality data structureincluding a set of parameters that control poetry generation using thepersonality data structure.
 2. The computer-implemented method of claim1 wherein the set of parameters in the personality data structurecomprises a plurality of weights to weight each of the plurality ofanalysis models in the personality data structure.
 3. Thecomputer-implemented method of claim 2 wherein each of the plurality ofweights comprises an integer value.
 4. The computer-implemented methodof claim 1, wherein the poems have corresponding authors, the methodfurther comprising: defining weight value of authors corresponding tothe poems within the personality data structure.
 5. Thecomputer-implemented method of claim 1, further comprising: definingweight values for each of a bigram, trigram and quadgram structures forone or more authors represented within the personality data structure.6. The computer-implemented method of claim 1, further comprising:defining values of exponents for each of a bigram, trigram and quadgramstructures for an author represented within the poet personality.
 7. Thecomputer-implemented method of claim 1 further comprising: providing aprobability value of using a rhythm and/or rhyme structures of an authorof the poems analyzed.
 8. A system comprising: a processing unit; and astorage device storing a process to generate a poet personality byconfiguring the processing unit to: analyze a plurality of poems, eachof the poems containing a plurality of words; generate a plurality ofanalysis models, each of said analysis models representing one of saidplurality of poems; mark words in the poems with rhyme numbers withwords that rhyme with each other having the same rhyme number; generatea data structure that specifies n-grams found in the text, with eachanalysis model having a set of weights, bigram, trigram and quadgramexponents; and store in computer storage the plurality of analysismodels in a personality data structure including a set of parametersthat control poetry generation using the personality data structure. 9.The system of claim 8 wherein the set of parameters in the personalitydata structure comprises a plurality of weights, to weight each of theplurality of analysis models in the personality data structure.
 10. Thesystem of claim 8 wherein the processing unit is further configured to:define weight value of authors corresponding to the poems within thepersonality data structure.
 11. The system of claim 8 wherein theprocessing unit is further configured to: define weight values for eachof a bigram, trigram and quadgram structures for an author representedwithin the personality data structure.
 12. The system of claim 8 whereinthe processing unit is further configured to: define values of exponentsfor each of a bigram, trigram and quadgram structures for an authorrepresented within the poet personality.
 13. The system of claim 8wherein the processing unit is further configured to: provide aprobability value of using a rhythm and/or rhyme structures for anauthor of each of the poems analyzed.
 14. A computer program productstored on a computer storage device, the product for generating a poetpersonality to configure a processor to: analyze a plurality of poems,each of the poems containing a plurality of words; generate a pluralityof analysis models, each of said analysis models representing one ofsaid plurality of poems; receive for the words in the poems rhymenumbers, with words that rhyme with each other having the same rhymenumber; generate a data structure that specifies n-grams found in thetext, with each analysis model having a set of weights, bigram, trigramand quadgram exponents; and store in computer storage the plurality ofanalysis models in a personality data structure including a set ofparameters that control poetry generation using the personality datastructure.
 15. The product of claim 14 wherein the set of parameters inthe personality data structure comprises a plurality of weights toweight each of the plurality of analysis models in the personality datastructure.
 16. The program of claim 14 wherein the program furtherconfigures the processing unit to: define a weight value of an authorrepresented within the personality data structure.
 17. The program ofclaim 14 wherein the program further configures the processing unit to:define a weight value for each of plural authors represented within thepersonality data structure.
 18. The program of claim 14 wherein theprogram further configures the processing unit to: define values ofweight for each of a bigram, trigram and quadgram structures for anauthor within the personality data structure; and define values ofexponents for each of a bigram, trigram and quadgram structures for anauthor within the poet personality.
 19. The program of claim 14 whereinthe program further configures the processing unit to: provide aprobability value of using a rhythm and/or rhyme structures for anauthor of each of the poems analyzed.